package com.tanhua.server.controller;

import com.tanhua.domain.vo.PageResult;
import com.tanhua.domain.vo.RecommendUserQueryParam;
import com.tanhua.domain.vo.TodayBestVo;
import com.tanhua.server.service.IMService;
import com.tanhua.server.service.TodayBestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

//今日佳人
@RestController
@RequestMapping("/tanhua")
public class TodayBestController {

    @Autowired
    private TodayBestService todayBestService;

    @Autowired
    private IMService imService;

    /**
     * 今日佳人：
     *  GET  /todayBest
     */
    @GetMapping("/todayBest")
    public ResponseEntity todayBest() {
        return todayBestService.queryTodayBest();
    }

    //推荐好友
    @GetMapping("/recommendation")
    public ResponseEntity recommendList(RecommendUserQueryParam queryParam){
        PageResult<TodayBestVo> pageResult=todayBestService.recommendList(queryParam);
        return ResponseEntity.ok(pageResult);
    }

    //佳人信息
    @GetMapping("/{id}/personalInfo")
    public ResponseEntity<TodayBestVo> queryUserDetail(@PathVariable("id")Long userId){
        TodayBestVo userInfoVo=todayBestService.getUserInfo(userId);
        return ResponseEntity.ok(userInfoVo);
    }

    //查询用户设置的陌生人问题
    @GetMapping("/strangerQuestions")
    public ResponseEntity<String> strangerQuestions(Long userId){
        String question=todayBestService.queryStrangerQuestions(userId);
        return ResponseEntity.ok(question);
    }

    //回复陌生人信息
    @PostMapping("/strangerQuestions")
    public ResponseEntity replyStrangerQuestions(@RequestBody Map<String,Object> paraMap) {
        imService.replyStrangerQuestions(paraMap);
        return ResponseEntity.ok(null);
    }
}
